Skip to content

Honor final output contracts on terminal stop responses#271

Merged
veithly merged 1 commit intomainfrom
codex/fix-terminal-stop-output-contract
Apr 23, 2026
Merged

Honor final output contracts on terminal stop responses#271
veithly merged 1 commit intomainfrom
codex/fix-terminal-stop-output-contract

Conversation

@veithly
Copy link
Copy Markdown
Collaborator

@veithly veithly commented Apr 22, 2026

Summary

  • trust spoon-core's normalized finish_reason="stop" even when the provider-native terminal status is completed
  • keep tool-budget fallback answers aligned with the latest user output contract instead of nudging the model toward recap-style summaries
  • add focused regressions for stop-termination and final tool-budget prompt behavior

Testing

  • python -m pytest tests/test_agent_llm_integration.py::TestAgentLLMIntegration::test_toolcall_agent_terminates_on_stop_even_when_native_reason_is_completed tests/test_agent_llm_integration.py::TestAgentLLMIntegration::test_toolcall_agent_uses_final_tool_free_summary_after_budget_exhaustion -q

OpenAI Responses can surface native terminal states such as "completed" even when spoon-core has already normalized finish_reason to "stop". Depending on the native field kept final answers inside the tool loop, and the tool-budget fallback prompt still nudged the model toward summaries instead of the user's requested format.

Constraint: Keep provider-specific termination handling inside spoon-core.
Rejected: Fixing only spoon-bot prompts while leaving core to keep looping on normalized stop responses.
Confidence: high
Scope-risk: low
Reversibility: high
Directive: Trust normalized stop termination and preserve strict final-output contracts in the terminal tool-budget prompt.
Tested: python -m pytest tests/test_agent_llm_integration.py::TestAgentLLMIntegration::test_toolcall_agent_terminates_on_stop_even_when_native_reason_is_completed tests/test_agent_llm_integration.py::TestAgentLLMIntegration::test_toolcall_agent_uses_final_tool_free_summary_after_budget_exhaustion -q
Not-tested: Full core integration suite
Related: PR 270 follow-up
@veithly veithly merged commit 2f33130 into main Apr 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant